package com.longqinuo.mycarservice.utils;

import android.graphics.Rect;

import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by zxw on 2016/6/24.
 */
public class SpaceItemDecoration extends RecyclerView.ItemDecoration{

    private int mSpace;

    public SpaceItemDecoration(int space) {
        this.mSpace = space;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
        if (parent.getChildItemId(view) != 0)
            outRect.top = mSpace;
    }
}
